package com.client.controller;

/**
 * Si la condition est vérifié, on vérifie la validité du {@link EntryController} en attribut
 * @author queyroi
 *
 */
public class IfThenCheckController implements EntryController {

	private boolean condition = false;
	private EntryController controller;
	
	public IfThenCheckController(EntryController controller,boolean condition) {
		this.condition = condition;
		this.controller = controller;
	}
	
	public boolean check() {
		if(condition) return controller.check();
		return true;
	}

	public String getSource() {		
		return controller.getSource();
	}
	
	/**
	 * Setteur condition
	 * @param condition La condition
	 */
	public void setCondition(boolean condition) {
		this.condition = condition;
	}

}
